// 基本信息
import { ElForm } from "element-plus";
import { defineComponent, PropType } from "vue";
interface DeviceForm {
	[key: string]: any;
}
export default defineComponent({
	props: {
		detail: {
			type: Object as PropType<DeviceForm>,
			default() {
				return {};
			}
		}
	},

	emits: ["submit"],
	setup(props) {
		type FormInstance = InstanceType<typeof ElForm>;
		const formRef = ref<FormInstance>();
		const formRule = reactive({});
		// const validData = () => {
		// 	formRef.value?.validate(valid => {
		// 		if (valid) {
		// 			if (!props.detail.name) {
		// 				props.detail.name = props.detail.sn;
		// 			}
		// 			emit("submit");
		// 		}
		// 	});
		// };
		return () => {
			return (
				<el-form model={props.detail} ref={formRef} rules={formRule} label-width="100" disabled>
					<el-form-item label="通知时间" prop="createTime">
						<el-input v-model={props.detail.createTime} />
					</el-form-item>
					<el-form-item label="通知对象" prop="userName">
						<el-input v-model={props.detail.userName} />
					</el-form-item>
					<el-form-item label="通知内容" prop="content">
						<el-input v-model={props.detail.content} rows="8" type="textarea" />
					</el-form-item>
				</el-form>
			);
		};
	}
});
